package gps.monitor.jt809server.startup;

import gps.monitor.common.core.base.AbstractServiceStarter;
import gps.monitor.jt809server.config.Jt809ServerConfig;
import gps.monitor.jt809server.service.DownConnectService;
import gps.monitor.jt809server.service.LinkStatusService;
import gps.monitor.jt809server.service.UpConnectService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author cyq
 * @date 2021/11/3
 * @desc talk is cheep,show me the code
 */

public class Jt809ServerStarter extends AbstractServiceStarter {

    @Autowired
    private Jt809ServerConfig jt809ServerConfig;

    @Autowired
    private UpConnectService upConnectService;

    @Autowired
    private DownConnectService downConnectService;

    @Override
    public boolean start() {

        System.out.println("started "+ jt809ServerConfig.getName() + " port:" + jt809ServerConfig.getPort());

        upConnectService.start(jt809ServerConfig.getPort());

        downConnectService.connect("127.0.0.1", jt809ServerConfig.getPort());

        return true;
    }
}
